home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 52
/
Volume 52 - JOGO DISK .iso
/
Games
/
shopdrop.swf
/
scripts
/
__Packages
/
MallWorld.as
< prev
next >
Wrap
Text File
|
2007-09-27
|
4KB
|
161 lines
class MallWorld implements smashing.World
{
var flScore = 0;
var score = 0;
var level = 1;
var bCollapse = false;
var nDist = 60;
var cDist = 0;
var scoreValue = 1;
var levelScore = 0;
var highestStack = 0;
var maxStackBonus = 200;
var maxStackScore = 0;
var bonusScore = 300;
function MallWorld(loc)
{
if(_global.bTries == true)
{
this.nLives = 5;
}
else
{
this.nLives = 3;
}
this.location = loc;
this.mcFloor = loc.mcFloor;
this.buildingsLeft = loc.buildingsLeft;
this.buildingsRight = loc.buildingsRight;
this.mcPlayer = loc.mcStuffHolder.mcPlayer;
smashing.Menu.watchProp(this,"score","text");
smashing.Menu.watchProp(this,"level","text");
smashing.Menu.watchProp(this,"highestStack","text");
smashing.Menu.watchProp(this,"maxStackScore","text");
smashing.Menu.watchProp(this,"levelScore","text");
smashing.Menu.watchProp(this,"nDistRatio","frameMeter");
smashing.Menu.watchProp(this,"lives","frameAnimMeter");
this.oPackages = new PackageHandler(loc.mcStuffHolder,loc.mcVanishing);
this.mcPlayer.aPackages = this.oPackages.oHandler.clips;
this.mcPlayer.oWorld = this;
this.mcPlayer.oPackages = this.oPackages;
this.oMusic = loc.mcMusic;
}
function onEnter()
{
}
function onExit()
{
}
function onPlay()
{
if(_global.bMute == false)
{
this.oMusic.playMusic();
}
this.mcPlayer.startWalk();
if(this.bCollapse == false)
{
this.buildingsLeft.playBuild();
this.buildingsRight.playBuild();
}
}
function onPause()
{
this.oMusic.stopMusic();
this.mcPlayer.stopWalk();
}
function onCollapse()
{
this.bCollapse = true;
this.buildingsLeft.stopBuild();
this.buildingsRight.stopBuild();
this.lives = this.lives - 1;
var _loc3_ = _global.mcRoot.mcPopups;
_loc3_._visible = true;
_loc3_.gotoAndPlay("loseTry");
}
function onUncollapse()
{
this.bCollapse = false;
if(this.lives <= 0)
{
_global.mcRoot.mcMenu.show("gameOver");
}
else
{
this.buildingsLeft.playBuild();
this.buildingsRight.playBuild();
this.mcPlayer.reset();
}
}
function onMaxStack()
{
this.maxStackScore += this.maxStackBonus;
this.flScore += this.maxStackBonus;
}
function onBonus()
{
_global.oSound.playSnd("pickUp");
this.flScore += this.bonusScore;
}
function update(nElapsed)
{
if(this.bCollapse == false)
{
this.oPackages.update(nElapsed);
this.cDist += nElapsed;
this.nDistRatio = this.cDist / this.nDist;
var _loc3_ = this.mcPlayer.nPackages - 1;
var _loc5_ = this.scoreValue * (_loc3_ * _loc3_) * nElapsed;
this.flScore += _loc5_;
this.score = Math.floor(this.flScore);
this.levelScore += _loc5_;
if(this.cDist >= this.nDist)
{
_global.mcRoot.mcMenu.show("endLevel");
}
if(this.mcPlayer.nPackages > this.highestStack)
{
this.highestStack = this.mcPlayer.nPackages;
}
}
this.mcPlayer.update(nElapsed);
if(Key.isDown(77))
{
_global.mcRoot.mcMenu.show("menu");
}
if(Key.isDown(80))
{
_global.mcRoot.oBase.pause();
}
}
function reset()
{
this.mcPlayer.reset();
this.oPackages.reset();
this.cDist = 0;
this.nDistRatio = 0;
this.levelScore = 0;
this.highestStack = 0;
this.maxStackScore = 0;
this.oMusic.reset();
}
function newGame()
{
this.mcFloor.gotoAndStop(1);
this.score = 0;
this.flScore = 0;
this.level = 1;
this.lives = this.nLives;
this.mcPlayer.reset();
this.reset();
}
function nextLevel()
{
this.level = this.level + 1;
this.mcFloor.gotoAndStop(this.level - 1 % this.mcFloor._totalframes + 1);
_global.mcRoot.mcXHair._visible = false;
this.reset();
}
}